<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<p id="d" style="float: left;font-size: 20px;"><span>登录</span></p>
<p id="z" style="float: left;margin-left: 200px;font-size: 20px;"><span>注册</span></p>
<p id="z" style="float: left;margin-left: 200px;font-size: 20px;"><span>用户:</span>
    <span style="display: none;color:firebrick" id="y"></span></p>
<p id="t" style="float: left;margin-left: 200px;font-size: 20px;display:none;"><span>退出</span></p>
<script>

 var token=JSON.parse(localStorage.getItem('token')) ;
console.log(token)

var d= document.getElementById("d");
 var z= document.getElementById("z");
 var y= document.getElementById("y");
 var t= document.getElementById("t");
 
 if(token){
     d.style.display="none";
     z.style.display="none";
     y.style.display="block";
     t.style.display="block";
     y.innerHTML=token.name;
 }
 t.onclick=function () {

     window.location.href="/logout"
 }



</script>
</body>
</html>